package com.mall.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import javax.persistence.*;

@Data
@Entity
@TableName("users")
public class Users extends BaseEntity {
    @Id
    @TableId(value = "id", type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String avatarUrl;

    private String name;

    private Integer age;

    @Column(nullable = false, columnDefinition = "tinyint(1)")
    private Integer gender;

    @Column(nullable = false, columnDefinition = "bigint(20)")
    private Long phone;

    @Column(nullable = false)
    private Integer store_id;

    private String email;

    private String username;

    private String password;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(nullable = false, columnDefinition = "datetime(0)")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    @Column(nullable = false, columnDefinition = "datetime(0)")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;
}
